/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Security;

import java.security.MessageDigest;

/**
 *
 * @author Don
 */
public class Hasher {
    
    public String Hash (String pass)
    {
        String password = pass;
        try
        {    
        MessageDigest md = MessageDigest.getInstance("SHA-256");
        md.update(password.getBytes()); 
        
         byte byteData[] = md.digest();
        
        java.math.BigInteger number = new java.math.BigInteger(1, byteData);
        
        return String.format("%1$064x", number);
        }
        catch(Exception e)
        {
            String st = "1212";
            return st;
        }

    }
    
}
